package main

import (
	"fmt"
	"math"
)

type rect struct { w, h float32}

type circle struct { r float32}

type shape interface {
	area() float32
	perimeter() float32
}

func (r *rect) area() float32 {
	return r.w*r.h
}

func (r *rect) perimeter() float32 {
	return 2*(r.w + r.h)
}

func (c *circle) area() float32 {
	return math.Pi*c.r*c.r
}

func (c *circle) perimeter() float32 {
	return math.Pi*2*c.r
}

func main() {
	r1:=&rect{25,4}
	c1:=&circle{10}

	var s shape=r1;
	fmt.Println(s.area())

	s=c1
	fmt.Println(s.area())

	var r2 *rect
	s=r2
	fmt.Println(s)
}
